<?php

namespace app\console\validate;

use think\Validate;

class GoodsValidate extends Validate
{
    protected $rule = [
        'supplier_id|供货商ID'         => 'require|number',
        'name|名字'         => 'require',
        'number|编号'       => 'require',
        'type|商品类型'     => 'require|number',
        'tags|标签'         => 'require',
        'is_packaged|组装方式'      => 'require|number',
        'material|木质材料'         => 'require',
        'has_storage|储物空间'      => 'require|number',
        'customizable|定制标识'     => 'require|number',
        'model|款式定位'    => 'require',
        'other_features|附加功能'   => 'require',
        'finish_meterial|饰面材料'  => 'require',
        'style|风格'        => 'require|number',
        'dispatch_place_province|发货地（省）'  => 'require',
        'dispatch_place_city|发货地（市）'      => 'require',
        'dispatch_place_address|发货地（地址）' => 'require',
        'skus|商品规格'      => 'require',
        'machining_scheme_id|加工方案ID'        => 'require',
        'attrs|商品属性'     => 'require',
        'invoice|提供发票'   => 'require|number',
        'guarantee|保修'     => 'require|number',
        'return_promise|退换货保证'  => 'require|number',
        'detail|产品详情'    => 'require',
        'page|页码'          => 'require|number',
        'perPage|每页数量'   => 'require|number',
        'search_start_time|查询开始区间'   => 'date',
        'search_end_time|查询结束区间'     => 'date',
        'status|状态'     => 'number',
    ];

    protected $scene = [
        'create' => ['supplier_id', 'name',
            'type', 'tags', 'number',
            'is_packaged', 'material', 'suitable_people',
            'has_storage', 'customizable', 'model',
            'fill', 'other_features', 'finish_meterial',
            'style', 'dispatch_place_province', 'dispatch_place_city',
             'dispatch_place_address', 'skus',
            'machining_scheme_id', 'attrs', 'invoice',
            'guarantee', 'return_promise', 'brand',
            'detail', 'remark'] ,
        'getPage'    => ['page', 'perPage', 'search_start_time', 'search_end_time', 'status'] ,
        'getAll'    => ['search_start_time', 'search_end_time', 'status'] ,
    ];

}